<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of app_controller
 *
 * @author morientez
 */
class AppController extends Controller {
    var $components = array('Acl', 'Auth','Session');

    function beforeFilter() {
        //Configure AuthComponent
        $ses=$this->Session->read();
        if(isset($ses['lang'])){
         $this->Session->write('lang', $ses['lang']);
         Configure::write('Config.language', $ses['lang']);
        }else{
            $this->Session->write('lang', 'fre');
         Configure::write('Config.language', 'fre');
        }
        $this->Auth->actionPath = 'controllers/';
        $this->Auth->authorize = 'actions';
         $this->Auth->allowedActions = array('display','changerLanguage');
        $this->Auth->loginAction = array('controller' => 'admins', 'action' => 'login');
        $this->Auth->logoutRedirect = array('controller' => 'pages', 'action' => 'display', 'home');
        $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home');
        $this->Auth->authError = "Désolé,  vous n'avez pas les droits suffisants.";
        $this->Auth->loginError = "Ce n'est pas le bon mot de passe ou nom d'utilisateur!";
    }
}

?>
